﻿#include<iostream>
#include<unordered_map>

int main() {

	std::unordered_map<int, std::string> map;

	map[1] = "Leon";
	map[2] = "Kenny";
	map[3] = "Jessie";

	//获取某个值
	std::string name = map[2];
	//删除某个键值对
	map.erase(1);

	//遍历键值对
	for (auto kv : map) {
		std::cout << "key: " << kv.first << ",value: " << kv.second << std::endl;
	}
	//迭代器遍历
	for (auto iter = map.begin(); iter != map.end(); iter++) {
		std::cout << "key: " << iter->first << ",value: " << iter->second << std::endl;
	}

	std::cin.get();
}